<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue1.0教程－第6章</title>
    <!--<script src="../libs/Vue1/vue.js"></script>-->
    <script src="../node_modules/vue/dist/vue.js"></script>

</head>

<body>

<div id="demo" >

    {{n}}

    <a v-on:click="onClick">触发一个方法函数</a>
    <a v-on:click="n++">触发一个表达式</a>
</div>

<script>

    var vm= new Vue({
        el: '#demo',
        data: {
            n: 0
        },
        methods: {
            onClick: function (e) {
                console.log(this);
                console.log(e.target);
                console.log(e.targetVM);
                console.log(e.target.tagName) // "A"
                console.log(e.targetVM === this) // true
                console.log(e.targetVM === vm) // true
            }
        }
    })
</script>
</body>
</html>